A Simple Optimal Representation for Balanced Parentheses
نویسندگان
چکیده
We consider succinct, or highly space-efficient, representations of a (static) string consisting of n pairs of balanced parentheses, that support natural operations such as finding the matching parenthesis for a given parenthesis, or finding the pair of parentheses that most tightly enclose a given pair. This problem was considered by Jacobson, [Proc. 30th FOCS, 549–554, 1989] and Munro and Raman, [SIAM J. Comput. 31 (2001), 762–776], who gave O(n)-bit and 2n+ o(n)-bit representations, respectively, that supported the above operations in O(1) time on the RAM model of computation. This data structure is a fundamental tool in succinct representations, and has applications in representing suffix trees, ordinal trees, planar graphs and permutations. We consider the practical performance of parenthesis representations. First, we give a new 2n + o(n)-bit representation that supports all the above operations in O(1) time. This representation is conceptually simpler, its space bound has a smaller o(n) term and it also has a simple and uniform o(n) time and space construction algorithm. We implement our data structure and a variant of Jacobson’s, and evaluate their practical performance (speed and memory usage), when used in a succinct representation of trees derived from XML documents. As a baseline, we compare our representations against a widely-used implementation of the standard DOM (Document Object Model) representation of XML documents. Both succinct representations use orders of magnitude less space than DOM and tree traversal operations are usually only slightly slower than in DOM.
منابع مشابه
Encodings of Multicast Trees
In this paper, we present efficient ways of encoding multicast trees. Multicast tree encodings provide a convenient way of performing stateless and explicit multicast routing in networks and overlays. We show the correspondence of multicast trees to theoretical tree data structures and give lower bounds on the number of bits needed to represent multicast trees. Our encodings can be used to repr...
متن کاملSuccinct Representation of Balanced Parentheses, Static Trees and Planar Graphs
We consider the implementation of abstract data types for the static objects: binary tree, rooted ordered tree and balanced parenthesis expression. Our representations use an amount of space within a lower order term of the information theoretic minimum and support, in constant time, a richer set of navigational operations than has previously been considered in similar work. In the case of bina...
متن کاملA Generic Numbering System based on Catalan Families of Combinatorial Objects
We study novel arithmetic algorithms on a canonical number representation based on the Catalan family of combinatorial objects. Our algorithms work on a generic representation that we illustrate on instances like ordered binary and multiway trees, balanced parentheses languages as well as the usual bitstring-based natural numbers seen through the same generic interface as members of the Catalan...
متن کاملApplication of n-distance balanced graphs in distributing management and finding optimal logistical hubs
Optimization and reduction of costs in management of distribution and transportation of commodity are one of the main goals of many organizations. Using suitable models in supply chain in order to increase efficiency and appropriate location for support centers in logistical networks is highly important for planners and managers. Graph modeling can be used to analyze these problems and many oth...
متن کاملEfficient EREW PRAM Algorithms for Parentheses-Matching
We present four polylog-time parallel algorithms for matching parentheses on an exclusive-read and exclusive-write (EREW) parallel random-access machine (PRAM) model. These algorithms provide new insights into the parentheses-matching problem. The first algorithm has a time complexity of O( log’ n ) employing O( & ) processors for an input string containing ~1 parentheses. Although this algorit...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Theor. Comput. Sci.
دوره 368 شماره
صفحات -
تاریخ انتشار 2004